import { ref } from 'vue';
import { getUserInfoAPI } from '@/api/user';
import { UserInfo, UserInfoResponseData } from '@/api/user/type';
import { HospitalDicData, HospitalDictArr } from '@/api/home/type';
import { getHospitalLevelAndRegionAPI } from '@/api/home';

export function useUserInfo() {
    let userInfo = ref<UserInfo>()
    let cardType = ref<HospitalDictArr>([])

    const getUserInfo = async () => {
        let res: UserInfoResponseData = await getUserInfoAPI()
        userInfo.value = res.data
        // if (userInfo.value.authStatus == 0) {
        let res1: HospitalDicData = await getHospitalLevelAndRegionAPI('CertificatesType')
        cardType.value = res1.data
        // }
    }

    return {
        userInfo, cardType, getUserInfo
    }
}